0

I want to run a project(in eclipse). On running I get the following(snapshot) error. I have read about how eclipse has problems finding path and have tried a few things but I am still stuck after spending my whole day in this. The file I am looking at has Main class and main function inside it and I could not find class 'Original' in any file(2k+). I had a new installation java and eclipse, if that matters. Any pointers would be really helpful.enter image description here

Subhodeep Maji
  • 100
  • 1
  • 10

1 Answers1

1

In Eclipse, select pull-down menu Run > Run Configurations....

In the Run Configurations. dialog, locate nodes nested below the Java Application node. Select them one at a time, and click the red X to delete them. Then close the dialog.

In the Package Explorer view on the left that shows your project and Java files, select the Main class. Right-click the class and select Run As -> Java Application.

Andreas
  • 154,647
  • 11
  • 152
  • 247
  • I have to use '-Djava.library.path=....' in run configurations argument. When I do what you said above without run configuration I get a new error which says 'java.io.FileNotFoundException: Properties file 'cdgclient/postgres.properties' not found in the classpath'. If I add the run configuration, then I get the old error. – Subhodeep Maji Mar 29 '20 at 21:32
  • 1
    The run configuration is where the class name to run is specified, so if it is trying to run class `Original`, then the run configuration is saying that. Fix the run configuration. --- If you had followed my instructions, then `Run As` -> `Java Application` would have created a new run configuration for the `Main` class, and you wouldn't have any run configurations naming the `Original` class. – Andreas Mar 29 '20 at 21:35
  • 1
    Since `java.library.path` has nothing to do with the `classpath`, I'm confused as to why not specifying that system property would show error about classpath. – Andreas Mar 29 '20 at 21:40
  • r1: When I add the library path(which has many jar files), could the order in which the jars are referenced be an issue? r2: Maybe when I specify the library path, the error is caught there first. Does it make sense? – Subhodeep Maji Mar 29 '20 at 21:43
  • 1
    The library path has *nothing* to do with loading `.jar` files. It is used for loading `.so` files (or `.dll` files on Windows). See e.g. [What is the relation between java.library.path and classpath](https://stackoverflow.com/q/24964012/5221149) – Andreas Mar 29 '20 at 21:47
  • Okay, my bad, I am new to eclipse and Java. I have two .so files in the library path, again, is there a reference order among them? – Subhodeep Maji Mar 29 '20 at 21:51
  • No, there is no order. If the library path lists more than one directory, they will or course be searched in the order listed. – Andreas Mar 29 '20 at 21:54