aspose file tools*
The moose likes Beginning Java and the fly likes Packages and Executables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Packages and Executables" Watch "Packages and Executables" New topic
Author

Packages and Executables

Betty Reynolds
Ranch Hand

Joined: Feb 16, 2000
Posts: 111
My environment is Windows 98. I installed java in the c:\jdk 1.2.2 directory with a path for this directory in autoexec.bat.
Most of my source and class files are in a directory name c:\java, so I presume this is my default directory. When I want to run an application, I just type in the command "java classname" from this directory.
I have a subdirectory under java called testdir. I created a source file called Forest with a package statement "package testdir;" at the beginning of the file and compiled it from this subdirectory so my class files are now in c:\java\testdir.
I can't get the program to run under the c:\java directory with the command "java Forest" or under the c:\java\testdir directory with the same command. Judging from the error messages, the loader is looking for a file named testdir/Forest, so I tried using "java testdir/Forest" and that works under the c:\java directory. Isn't the forward slash a Unix naming convention for directories? Can anyone explain what is going on here?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
That is a bit strange. My guess is that there's some code that they developed on Solaris which they neglected to change in the Windows version. However, try "java testdir.Forest" instead - that should work, and is platform-neutral.


"I'm not back." - Bill Harding, Twister
Betty Reynolds
Ranch Hand

Joined: Feb 16, 2000
Posts: 111
Thanks Jim. That worked.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
dear friends ,
pl help me out
following message is there "java.awt.event not found on import"
(i am using jdk 1.2.1 ),when i try to import event package,...
i have also tried to use package class to find what packages are available
but again the message "package class not found " is there.
how can i know what packages are there ? pl tell me
thanks
samar
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Samar- I answered here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Packages and Executables
 
Similar Threads
Classpath.......please show me a path
Nullpointer when reading a directory
K&B Exercise 1-1
Problems with import/package statements
how to make two classes in a packahe where one class extends the other