• 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

Installing JDK & PATH

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

I am very much interested in learning Java. I am practising lots of programs in my home. In office, in the free time I want to practise some progrmas. So that I downloaded the JDk 15. and I couldn't install it, due to administration doesn't allow it.

However, I succesffully installed it. I copied the JDK1.5 folder(which includes bin folder) from the home and copied in one of my folders in the office. While I am compiling and running the java files by keeping it in the bin folder, it it compiling and running.

I want to add the environment variable. Can I add that variable in Control Panel >> system >> advanced >> environment variables. Whether by adding the path, it will give any other problem to the system. We are using Windows XP professional Edition.

I want to practise some java programs in the free time without causing any damage or interrupt to the machine at office.

Please advice me regd this.
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not really a Java question, but yes - as a regular (non-admin) user you should be able to change the user environmental variables but not the system ones. Add a path variable for your own user and it will be used in addition to the system PATH variable.
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Skip setting the CLASSPATH. That can be a security risk and a source of bugs. Use the -classpath switch.

javac -d bin Test.java
java -classpath bin Test

Another example of compiling something in one folder and putting the class in another and then running it. Note that you should use forward slashes in your classpath but either will work.

javac -d /sandbox/bin /sandbox/src/Test.java

java -classpath /sandbox/bin Test

In this example you need a jar to run and to compile. In that case you specify the jar itself not just the folder it lives in as you do using classes.

javac -d /sandbox/bin -cp /acme/rocket.jar /sandbox/src/Test.java
java -cp /acme/rocket.jar:sandbox/bin Test

I used the abbreviated cp instead of classpath that time. Also note that each item in the path must be separated with a colon or a semicolon when using Windows.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My bad - I interpreted the original post as wanting to change the PATH variable, not the CLASSPATH. Yes, I agree with Rick - setting the classpath variable is a bad idea in many situations.
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic