Hi everyone,
I've been working on getting jBoss to compile and run
from Netbeans/Forte in Windows. The major problems I
had were related to jBoss not finding directories and
files where I expected. I finally got it to work, so
I thought I'd share my experiences...
0) Install jBoss to c:\jBoss and make sure it's
working.
1) download Netbeans 3.1 from www.netbeans.org.
Install to c:\netbeans3_1.
2) Start up Netbeans from the c:\jboss directory or a
shortcut with c:\jboss as the working directory.
3) Add the following files and directories to the
Netbeans explorer:
- all jar files under c:\jboss\lib and
c:\jboss\lib\ext
- c:\jboss\src
- c:\jboss\conf
- c:\jboss\conf\default
- c:\jboss\log
- c:\jboss\db
4) perform the following directory tree copies:
- copy c:\jboss\conf to c:\
- copy c:\jboss\db to c:\
- copy c:\jboss\deploy to c:\
(c:\deploy will be the deployment directory)
You should be able to compile/run/debug without jboss
throwing any exceptions. I'm not sure if there is a
better way to get this working - please let me know if
there is. Another problem I noticed with Netbeans 3.0
is with using the fastjavac compiler, so turn it off
or use Netbeans 3.1.
I think these problems are related to the multiple
ways used in then main method to get handles to
files/directories (i.e. using
ClassLoader.getResource() and the File class). I
wrote a program to investigate the differences of
these two methods and had very interesting results.
Create this file in
c:\netbeans3_1\development\TestDir.java and start
Netbeans from the c:\jboss directory.
import java.io.*;
import java.net.*;
public class TestDir extends Object {
public static final void main(String[] arg) {
try {
File f = new File(".");
System.out.println(f.getCanonicalFile().toURL().getFile());
URL u =
TestDir.class.getClassLoader().getResource(".");
System.out.println(u.getFile());
URL u2 =
TestDir.class.getClassLoader().getResource("./readme.txt");
System.out.println(u2.getFile());
} catch (Exception e) {
e.printStackTrace();
}
}
}
If I run the program from the command line like this:
cd\netbeans3_1\development
java -cp . TestDir
I get the following output:
/C:/netbeans3_1/Development/
/C:/netbeans3_1/Development/
/C:/netbeans3_1/Development/readme.txt
If I run the program from Netbeans I get these
interesting results:
/C:/jBoss/
/C:/netbeans3_1/system/
/C:/netbeans3_1/Development/readme.txt
Is this a bug in Java or Netbeans or am I doing
something else wrong? Should jBoss be generating path
names in a different way to get around this (if so I
can do it)? This is my first experience with jBoss -
it looks like an awesome project!
Jason
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/