Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error In the code

 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


can anybody help me in resolving the error in the bold lines??

AFter compilation "an not found class of these bold lines"
Between lines 14 to 17..
 
Tony Docherty
Bartender
Posts: 2936
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each of those lines constructs an object and adds it to the tabbed pane. The compiler can't find any of those classes so where are the Sharp, Blurr, Edge etc classes?
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii Tony

These classes are in the same folder where this Main.java exist..
 
Tony Docherty
Bartender
Posts: 2936
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried compiling one of those classes eg Sharp.java?
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah,, but they are also not compiling...



here line 66, 71, 76 and 81 have errors .. can't rechognise Main..
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you compiling? Do you use javac from a command line, or use a build tool like Ant or Maven, or use an IDE like IntelliJ or Eclipse. The trick is going to be compiling all source files in the package at once so the compiler can resolve all the cross-references you have. You might also consider refactoring to reduce the cross-references. This could make the program easier to work with in a number of ways.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have compiled my programm using Javac key word in cmd..
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15203
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the exact command that you are typing to compile the source code? And what exactly is the output? (Please copy & paste the command and the output from the compiler).
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[pedantic mode]It is not Javac, but javac. And it is not a keyword. It is a program name.[/pedantic mode]
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah i am soory,, it was a typing mistake .. happens in the foram post only..
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "javac *.java" instead of "javac Sharp.java". Keep any other compile flags you may be using the same.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Jesper de Jong
Here is the copy of cmd where i am trying to run Main.java ..


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\SINGHALS>cd desktop

C:\Users\SINGHALS\Desktop>cd ImageProject

C:\Users\SINGHALS\Desktop\ImageProject>cd ImageProject

C:\Users\SINGHALS\Desktop\ImageProject\ImageProject>javac Main.java
Main.java:14: cannot find symbol
symbol : class Sharp
location: class Main
tabs.addTab("Sharp",new Sharp());
^
Main.java:15: cannot find symbol
symbol : class Blurr
location: class Main
tabs.addTab("Blurr",new Blurr());
^
Main.java:16: cannot find symbol
symbol : class Edge
location: class Main
tabs.addTab("Edge",new Edge());
^
Main.java:17: cannot find symbol
symbol : class AntiAlias
location: class Main
tabs.addTab("AntiAlias",new AntiAlias());
^
Main.java:18: cannot find symbol
symbol : class Epipolar
location: class Main
tabs.addTab("Epipolar",new Epipolar());
^
Main.java:19: cannot find symbol
symbol : class DGFilter
location: class Main
tabs.addTab("Direction Gaussian Filtering",new DGFilter());
^
6 errors

C:\Users\SINGHALS\Desktop\ImageProject\ImageProject>
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which folder are those .java files in? Which folder are you trying to compile from?
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of these files reside in "C:\Users\SINGHALS\Desktop\ImageProject\ImageProject" folder..
and i am trying to compile them in the same folder..
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And none has a package declaration?
I tried your two classes, had to remove the bold tags (don’t put any other tags inside code tags; they don’t work), commented out the addition of Blurr (it should be Blur) etc., and it both compiled and ran for me.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope none has Package decleration

After changing the blurr --> blur
Still unable to compile the Main.java file..
got the same 6 errors
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I commented out the lines with the classes in which you didn’t supply (Blur, Edge, etc), I was able to compile and run it. Where are the Blur, Edge, etc, .java and .class files?
 
Roshan Wankhade
Greenhorn
Posts: 21
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friend,
I think you should compile all the source file at once by following command

javac file1.java file2.java
or using
javac *.java

then run Main Class



 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please share the source of the dependent files ( Blurr, AntiAlias, EpiPolar) which the compiler is unable to resolve.
 
Tony Docherty
Bartender
Posts: 2936
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No don't post the rest of the files they are not necessary.

You've probably set the CLASSPATH env variable and not included the current directory. Try the following
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah Toni..
Thanks finally compiled..

That is My Environment variables are not perfect..
Thanks
 
Tony Docherty
Bartender
Posts: 2936
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks finally compiled..

My pleasure

That is My Environment variables are not perfect..

Looks that way. I suggest you append a ";." to the CLASSPATH environment variable value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic