Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Reset classpath and sourcepath to default

 
Leandros Ntouras
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, so I must have accidently changed the default classpath and sourcepath of java with something like "set ClASSPATH=" . Now when i try to compile and run a "Main" like that the .class files are generated correctly but when I run I get the following: and the path that it searches to find "Main.java" is the path of the folder that I must have changed the sourcepath to. How do I reset these variables to look in the current directory?
 
Liutauras Vilda
Marshal
Posts: 7178
491
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

No panic here

Can you close command prompt and open again and repeat steps executing your app - is it the same?

Also, issue this instruction and tell what you get: echo %CLASSPATH%
 
Liutauras Vilda
Marshal
Posts: 7178
491
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, do you have package defined in your Main class?
 
Leandros Ntouras
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh I feel stupid now, there was a package declared in the files that Ι didn't notice since I didn't write them..Thanks for that!
 
Stephan van Hulst
Saloon Keeper
Posts: 10657
227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Important: don't use environment variables to store source- and classpaths. It leads to problems eventually.

You must always provide these paths to the compiler and virtual machine explicitly, using the -sourcepath and -cp command line switches. If you think this is a lot of work, use a build tool like Maven to compile and run your application.
 
no wonder he is so sad, he hasn't seen this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!