Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Class file not being made

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have just installed Java and am trying to get it setup. I've set the following as the Environment variables

PATH is C:\Program Files\Java\jdk1.6.0_24\bin
CLASSPATH is C:\Program Files\Java\jdk1.6.0_24\jre\bin

I can run javac and my program compiles. I can run javac and see all the options.

But no class file is being created.

I'm using Windows 7 64 bit, i've installed using the 64 bit installer. Its created this directory as well C:\Program Files\Java\jre6\bin
I've tried setting the CLASSPATH to this but still get same problem.

 
author
Posts: 23878
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Two points...

1. CLASSPATH is for the root directories of you class files. It is *not* for you executables.

2. The compiler will place class files based on the packages it is in.


So... it would help if you tell us where the java files are located, from where you are running the compiler, and if your code uses packages.

Henry
 
Hon Chan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Henry,

The problem with the class file is now gone, I made a silly mistake, for some reason my Java file had not saved and it was just a blank file I was compiling.

Now the class file is being created but I still got the class not found exception. I found a workaround for the problem, java -classpath . [filename] lets me run the file.

I'm running javac from the directory I have my java files saved in.
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hon Chan wrote:
I'm running javac from the directory I have my java files saved in.



That helps.
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic