Results 1 to 20 of 33
Thread: A problem with the import part
- 06-08-2012, 05:28 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
- 06-08-2012, 05:47 PM #2
Re: A problem with the import part
Please post the full text of the error message and the source where the error occurs.
If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 07:52 PM #3
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
import java.io.someclass1;
import java.io.someclass2;
import java.io.someclass3;
import java.lang.String;
import java.io.*;
keyboard.java:2: error: cannot find symbol
import java.io.someclass1;
^
symbol: class GlobalKeyListener
location: package java.io
keyboard.java:3: error: cannot find symbol
import java.io.someclass2;
^
symbol: class KeyAdapter
location: package java.io
keyboard.java:4: error: cannot find symbol
import java.io.someclass3;
^
symbol: class KeyEvent
location: package java.io
the classеs are there.
- 06-08-2012, 07:56 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,604
- Blog Entries
- 7
- Rep Power
- 17
Re: A problem with the import part
Is there a class 'someclass1' in the java.io pacakge? I didn't know that.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-08-2012, 08:03 PM #5
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
This is a class which i added to java.io pacakge
- 06-08-2012, 08:06 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,604
- Blog Entries
- 7
- Rep Power
- 17
- 06-08-2012, 08:10 PM #7
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
But then how i can add/change classes in java.io ? before there was not a problem.
- 06-08-2012, 08:12 PM #8
Re: A problem with the import part
Extend them to make your own class.
If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 08:39 PM #9
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
Ok now I have another error:
import de.ksquared.test.system.keyboar.*;
import de.ksquared.system.keyboard.GlobalKeyListener;
import de.ksquared.system.keyboard.KeyAdapter;
import de.ksquared.system.keyboard.KeyEvent;
package de.ksquared.test.system.keyboard;
public class KeyboardHookTest {
public static void main(String[] args) {
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
@Override public void keyPressed(KeyEvent event) { System.out.println(event); }
@Override public void keyReleased(KeyEvent event) {
System.out.println(event);
if(event.getVirtualKeyCode()==KeyEvent.VK_ADD
&& event.isCtrlPressed())
System.out.println("CTRL+ADD was just released (CTRL is still pressed)");
}
});
while(true)
try { Thread.sleep(100); }
catch(InterruptedException e) { e.printStackTrace(); }
}
}
D:\project>javac KeyboardHookTest.java
KeyboardHookTest.java:6: error: class, interface, or enum expected
package de.ksquared.test.system.keyboard;
^
1 error
- 06-08-2012, 08:43 PM #10
Re: A problem with the import part
The package statement goes first.
If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 08:46 PM #11
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
Ok now I got this:
KeyboardHookTest.java:4: error: package de.ksquared.test.system.keyboar does not
exist
import de.ksquared.test.system.keyboar.*;
^
KeyboardHookTest.java:5: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.GlobalKeyListener;
^
KeyboardHookTest.java:6: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.KeyAdapter;
^
KeyboardHookTest.java:7: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.KeyEvent;
^
KeyboardHookTest.java:13: error: cannot find symbol
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
^
symbol: class KeyAdapter
location: class KeyboardHookTest
KeyboardHookTest.java:13: error: cannot find symbol
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
^
symbol: class GlobalKeyListener
location: class KeyboardHookTest
- 06-08-2012, 08:52 PM #12
Re: A problem with the import part
Are the definitions for those packages on the classpath? The compiler can not find them. What is on the classpath when you try to compile?
If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 08:54 PM #13
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
Nothing it is by default
- 06-08-2012, 09:03 PM #14
Re: A problem with the import part
It needs to point to the folder that contains the folder at the start of the package: de
If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 09:07 PM #15
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
and again...
D:\project>javac -classpath "C:\Program Files\Java\lib\de" KeyboardHookTest.java
KeyboardHookTest.java:4: error: package de.ksquared.test.system.keyboar does not
exist
import de.ksquared.test.system.keyboar.*;
^
KeyboardHookTest.java:5: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.GlobalKeyListener;
^
KeyboardHookTest.java:6: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.KeyAdapter;
^
KeyboardHookTest.java:7: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.KeyEvent;
^
KeyboardHookTest.java:13: error: cannot find symbol
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
^
symbol: class KeyAdapter
location: class KeyboardHookTest
KeyboardHookTest.java:13: error: cannot find symbol
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
^
symbol: class GlobalKeyListener
location: class KeyboardHookTest
6 errors
- 06-08-2012, 09:12 PM #16
Re: A problem with the import part
I said: It needs to point to the folder that contains the folder at the start of the package: de
Does the folder de contain a folder de?"C:\Program Files\Java\lib\de"If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 09:14 PM #17
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
It is the same.
D:\project>javac -classpath "C:\Program Files\Java\lib" KeyboardHookTest.java
KeyboardHookTest.java:4: error: package de.ksquared.test.system.keyboar does not
exist
import de.ksquared.test.system.keyboar.*;
^
KeyboardHookTest.java:5: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.GlobalKeyListener;
^
KeyboardHookTest.java:6: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.KeyAdapter;
^
KeyboardHookTest.java:7: error: package de.ksquared.system.keyboard does not exi
st
import de.ksquared.system.keyboard.KeyEvent;
^
KeyboardHookTest.java:13: error: cannot find symbol
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
^
symbol: class KeyAdapter
location: class KeyboardHookTest
KeyboardHookTest.java:13: error: cannot find symbol
new GlobalKeyListener().addKeyListener(new KeyAdapter() {
^
symbol: class GlobalKeyListener
location: class KeyboardHookTest
6 errors
- 06-08-2012, 09:25 PM #18
Re: A problem with the import part
How about waiting on this complicated project and writing a small simple program that uses one class in a package that is in a folder. When you get that to work, then move on to this more complicated project.
There are so many things you could have set up incorrectly that chasing them all down is going to take too long. Start with a simple project.If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 09:34 PM #19
Member
- Join Date
- Feb 2012
- Posts
- 61
- Rep Power
- 0
Re: A problem with the import part
ok.Some suggestions>
- 06-08-2012, 09:41 PM #20
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,604
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
problem in java import
By black300 in forum New To JavaReplies: 2Last Post: 04-05-2011, 07:56 AM -
Problem import query.*
By teaicky in forum New To JavaReplies: 4Last Post: 02-05-2011, 11:09 PM -
Problem with import libraries
By sarwar1234 in forum New To JavaReplies: 3Last Post: 09-21-2010, 10:38 AM -
MultiThreading Problem part 2
By ravjot28 in forum New To JavaReplies: 33Last Post: 03-11-2010, 06:22 PM -
import problem
By anki.gulsvart in forum NetworkingReplies: 9Last Post: 10-16-2009, 07:03 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks