• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting the classpath

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.

I'm having a problem with setting the classpath. I'm trying to use the SkinLookAndFeel thingy but for example if I use the



the compiler says "package not found". I've included the class path using the control panel like .;C:\Java\Skins\skinlf.jar but still its not working. However, it works if I put the *.jar files in the ext directory in the JDK../JRE folder. It also works if I include the path in the JDK profile of the compiler, but what if try to run it on another computer?

What am I doing wrong? Is it possible to set the class path in the code?
I've read some articles where they describe running the program like
java -classpath /java/MyClasses/myclasses.jar utility.myapp.app
How will I get it to work if I create an exe using an installer to run my program?

Also, does any of you guys know of an installer(I hope a free one) that would automatically detect the Java Home folder and place the Skin files in the ext folder?

Thanks
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possible solution to your problem is to pacakge your program as an executable JAR file. You need to include a manifest file in the JAR with Main-Class: and Classpath: attributes. This will make it so that the user can double-click on the JAR to run it, as long as the JVM is installed and configured correctly.

HTH

Layne
 
Darrell Morello
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any rules in how I include it in the manifest file? And this means that I have to create a jar file whenever I want to test it right?
Also, whenever I double-click on my jar files, WinRar always opens it, even though I have dis-associated jar files from it I havent found a way to get around it yet.

Thanks for the quick reply
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you on Windows? It is possible to change the default open command by going into windows explorer, Tools | Folder Options | File types and scroll down to jar files. Edit that and you will get a list of commands, select one and click Set Default to change the default. You can add a new one if needed.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A manifest file is simply a text file that gets packaged into the JAR file in a particular way. You need to use the -m option in order to specify your own manifest file. If you are using the command-line, type "jar" without any options to see the syntax for adding a manifest file.

HTH

Layne
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic