JAVA Environment

J

jo

Hallo

I would like to use a cass from a selfmade package.

The papackage contains the files My_Paket.java and My_Paket.class;

in the Directory: D:\JAVA\klassen



package My_Paket;

public class My_Paket

{

public static void showscreen()

{

System.out.println("This comes from My_Paket");

}

}



The methode ausgabe should be used in

D:\JAVA_TEST\MyCall\ Mycall.java



import MyPaket;

public class Mycall

{

public static void main (String args[])

{

System.out.println("hallo");

MyPaket.showscreen();

}

}



I gues my settings were wrong therefore I tried to run java in a batch file:

path= D:\JAVA\bin

set CLASSPATH= .;D\:JAVA\klassen

set path

set classpath

javac.exe Mycall.java

pause



The computer seems not to find the classes - why??



D:\JAVA_TEST\MyCall>set classpath

CLASSPATH= .;D\:JAVA\klassen



D:\JAVA_TEST\MyCall>javac.exe Mycall.java

Mycall.java:1: package MyPaket does not exist

import MyPaket.*;

^

Mycall.java:8: cannot resolve symbol

symbol : variable MyPaket

location: class Mycall

MyPaket.showscreen();

^

2 errors



Any help is appreciated a link to a tutorial with a detailed description
woul also help

Joachim
 
T

Thomas Weidenfeller

jo said:
I would like to use a cass from a selfmade package.

The papackage contains the files My_Paket.java and My_Paket.class;

You at least mixed up your naming:

package My_Paket; [...]
import MyPaket;

Settle on one name. Typically, the second one (no underscore) is
according to common Java conventions.

The computer seems not to find the classes - why??

Because you are using the wrong name.

Regarding your messing with the classpath, please spend some time and read

http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html

before touching it.

Oh, and consider comp.lang.java.help for such questions.

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top