• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Class file not being made

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 23907
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



That helps.
 
You showed up just in time for the waffles! And 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
reply
    Bookmark Topic Watch Topic
  • New Topic