File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes jar file execution in linux. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "jar file execution in linux." Watch "jar file execution in linux." New topic
Author

jar file execution in linux.

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
I have opened a topic under http://www.coderanch.com/forums/, but then realised this might be an apt place.

I have created a swing application under windows enviroment using netbeans. It works perfectly fine when I double click the jar file. Then I moved my source code under linux machine /home/userrig/temp/testing.jar. If I chane my dir to cd /home/deo/temp and start executing jar like
, swing application starts executing. But if I try to start the swing application under /home like
, I get the error as follows.

Do I have to set the path for this jar instance? How do I proceed.
Next question is whether to go KDE or GNOME for icon creation. I have just started reading about them. Or writing any batch script is enough to start the application. Thanks.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

There shouldn't be any problem whether you do

or

Both do the same thing.

I think probably there's a hardcoded path or something in the
testing.testing.createGUI(testing.java:200)

If you can provide the code for that method, maybe someone here can help.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
Thanks. I developed the application in netbeans and then deployed the jar file in linux using ssh and tested it. I always went for "clean and build" option in netbeans to create jar file. I just now noticed that I get the same nullpointerexception if I try to do "run Project" in netbeans. I have not harcoded any where in the application.
My main method is as follows



createGUI is a method which instantiates all the swing components and so on. Is there anything to do with netbeans properties?
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

That's very strange. It could be that some of the NetBeans' project config files are corrupted. Can you try to create a new Project in NetBeans and copy over all the source files and build them again.
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
I figured it out. Since I am reading some info from a config.properties file, I had to put a copy of config file from where I can launch my jar file. Once it is done, I am able to lauch from



So teh config.properties file has to be in the directory from where the application can be launched or is tehre any other way to handle this situation?

My next goal is to create an icon on linux desktop so that if the user wants to open the application, just a double will do. Any reading material to start with? Thanks.
[ May 08, 2008: Message edited by: Gopu Akraju ]
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

In Gnome, ff you do it manually, just right click -> Create Launcher -> enter the name and command. If you wanna do it programmatically, you need to create a desktop file in your $HOME/Desktop, e.g.

test.desktop
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar file execution in linux.