• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package element does not exist

 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a beginner in Java. I was trying to install JavaElement. I followed all instructions properly to set Environmental Variables (My computer > properties > advanced > Environmental variables). I am using ConText as text editor in xp. When I run following codes:
*****************************************************
import element.*;
public class test
{
public static void main(String[] args)
{
System.out.println("Dit is een test");
}
}
*****************************************************
I get error:
*****************************************************
> Executing: C:\Program
Files\ConTEXT\ConExec.exe "K:\Yava\jdk\bin\javac.exe" "K:\Yava\jdk\test.java"

K:\Yava\jdk\test.java:1: package element does not exist
import element.*;
^
1 error
> Execution finished.
*****************************************************

Please help me!

Thank you.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the program it seems that the line isn't necessary - you can simply delete it. If the "element" package is something that's actually used, then you need to add it to your classpath, either by setting the CLASSPATH environment variable, or by some setting it in your software.
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

Thank you for your reply.

The program I think is to check if Element package is working or not. In my case it is not!
My Environemnt variables are as follows:

Use variable name: je
User Variable Values> .; K:\Yava\jdk\lib; K:\Yava\jdk\lib\element.zip

System Variable Name: Path
System Variable> %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\PROGRA~1\COMMON~1\AUTODE~1; K:\Yava\jdk\bin


Still the same problem persists.

Please help me!

Thanks!
 
Henry Wong
author
Marshal
Pie
Posts: 21186
80
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Use variable name: je
User Variable Values> .; K:\Yava\jdk\lib; K:\Yava\jdk\lib\element.zip


Java classes are stored in jar files -- which is basically a zip file with extra stuff. Does this element.zip exist? And if it does, is it a valid jar file? And finally, when you list the contents for this jar file, does it contains any classes in the element package?

Henry
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
***************************************************************************
Java classes are stored in jar files -- which is basically a zip file with extra stuff. Does this element.zip exist? And if it does, is it a valid jar file? And finally, when you list the contents for this jar file, does it contains any classes in the element package?
***************************************************************************

Hi Henry,

Thank you for your reply.

I have that element.zip file in the lib. But when I go to its properties I find it is a zip file. I unzipped this zip file and the new element folder contains all class file in the same lib folder. I have some executable jar files in this folder but not as in executable jar file in the form of zip file. I am not sure if I could explain or give you any clue.

Regards!
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zip files work just as well as jar files. As long as the element folder is at the top level of the zip file, it should work fine.
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still the same error..Package element does not exist!!

HELPPPPPPPP PLSS!
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.

Here is the code to see if my element package is working:
----------------------------
import element.*;
public class test
{
public static void main(String[] args)
{
System.out.println("Dit is een test");
}
}
-----------------------------
upon compiling I get this error:
-----------------------------
> Executing: C:\Program Files\ConTEXT\ConExec.exe "C:\j2sdk1.4.2_11\bin\javac.exe" "C:\j2sdk1.4.2_11\test.java"

C:\j2sdk1.4.2_11\test.java:1: package element does not exist
import element.*;
^
1 error
> Execution finished.
----------------------------
My Environemntal variables are set as follows:
----------------------------
User variable CLASSPATH:
CLASSPATH=.;C:\j2sdk1.4.2_11\lib;c:\j2sdk1.4.2_11\lib\element.zip

System Variables append the following to the variable Path:
;C:\j2sdk1.4.2_11\bin

I installed Java from K:\ to C:\ in the hoope of "By any chance"!!! But the same error.....................

Pls Help!

Thanks!
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to make sure one more time: the "element" folder that contains the classes is at the top level of the element.zip file?

Does it work if you unzip the file, and add the folder containing the element folder to your classpath?
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it work if you unzip the file, and add the folder containing the element folder to your classpath?

(For Ulf)

- Just to make sure one more time: the "element" folder that contains the classes is at the top level of the element.zip file?
1. What do you mean by top level? like..\element\element.zip?
-Just to make sure one more time: the "element" folder that contains the classes is at the top level of the element.zip file?
2.It works with the following error:
-----------------------------------
> Executing: C:\Program Files\ConTEXT\ConExec.exe "C:\j2sdk1.4.2_11\bin\java.exe" test

java.lang.NoClassDefFoundError: test
Exception in thread "main"
> Execution finished.
-----------------------------------
Now what..
:roll:
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it work if you unzip the file, and add the folder containing the element folder to your classpath?
---------------------------------------------
It works like charm! THANK YOU!
But then this new killer! As I try to run this simple program!
---------------------------------------------
class HelloWorld {
//
public static void main (String args[]) {
System.out.print("Hello World ");
}
}
---------------------------------------------
The error:
---------------------------------------------
> Executing: C:\Program Files\ConTEXT\ConExec.exe "C:\j2sdk1.4.2_11\bin\java.exe" test

java.lang.NoClassDefFoundError: test
Exception in thread "main"
> Execution finished.
---------------------------------------------
My environmental variables:
---------------------------------------------
User variables values: set CLASSPATH=.;C:\j2sdk1.4.2_11\lib; c:\j2sdk1.4.2_11\lib\element; C:\j2sdk1.4.2_11\bin
SYstem variable values: .;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\PROGRA~1\COMMON~1\AUTODE~1; C:\j2sdk1.4.2_11; C:\j2sdk1.4.2_11\bin\
---------------------------------------------
Help Pls!

Thank you in advance once again!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you try to run "java test"?
Your class is called HelloWorld, not test.

Try "java HelloWorld".
 
Farhana Faisal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry for that mistake. FOr any program the error is the same! Test or HelloWorld whatever is tried!

Any more ideas?

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic