Thanks. Almost there.

Sigh. You were correct. There were two main programs. One was deleted leaving the main main.

I tried right-click->Debug and it worked.

I tried Debug->File and it worked.

I tried Debug->Main Program and it did not work. The error is:

ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [t:\workspace\open\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c:734]
Command execution failed.

I changed <exec.mainClass>com.mycompany.slip.Slip</exec.mainClass> to <exec.mainClass>test.main</exec.mainClass> On the first version, Debug gave me a pom error saying it could not find the main file. On the second version I got the above error. My guess is that I' m going to have to read and understand Maven and relate Maven to some required folder architecture. I'm not sure about this. Right now it's only a guess.

I would like to use the debugged API in other projects, so the issue is persistent and important. Any help would be good. No help just means that I have to struggle through documentation to find the little nugget needed to make the project work as expected. And yeah, I know. This is one of those 'easy' ones that everyone knows.

art

On 4/2/2024 11:28 AM, Michael Bien wrote:
the exec.mainClass property of pom.xml is the main entry point of your program and becomes relevant if you want to run the project in the shell or once its built.

NB can run anything which has a main method or any test simply via right click -> run/debug. It doesn't really care what is in the property so you don't have to permanently change it just so that you can test something. You can even remove it and it will run fine if you press play.

My guess is that you ran the project once and NB asked you what Main class to start (do you have two?). The default setting of the dialog remembers the choice for the rest of the session and won't ask again. Then you moved or renamed the class and now it can't find it, NB should ask again if you restart.

-mbien

On 02.04.24 20:19, slipbits wrote:

Thanks  Tamás;

I didn't know that and I'm glad you mentioned it. But the real question is how do I test the fool thing. I compiled everything successfully under NB. I built everything successfully under NB. Now here is where my ignorance shows. I don't want the fool thing located under "com.mycompany.slip.Slip". I know that this is referenced in the pom.xml file, but, if I change the pom entry my question is what do I have to do to the source folders? Going from <exec.mainClass>com.mycompany.slip.Slip</exec.mainClass> to <exec.mainClass>Slip</exec.mainClass> will this work and do I have to change the folder structure in some way? Or quite baldly, 'what do I do now coach"?

I'm reading the Maven document to find out how changing <exec.mainClass> effects the folder architecture but a little word of wisdom would save me a lot of time.

thanks

The run output dialog is below.

JPDA Listening Start...
JPDA Address: 127.0.0.1:52253
Port:52253
cd D:\home\skidmarks\Projects\Unique\Project\slip; "JAVA_HOME=C:\\Program Files\\Java\\jdk-17.0.1" cmd /c "\"C:\\Program Files\\NetBeans\\NetBeans-20\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dexec.vmArgs=-agentlib:jdwp=transport=dt_socket,server=n,address=52253 \"-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}\" -Dexec.appArgs= -Dexec.mainClass=com.mycompany.slip.Slip \"-Dexec.executable=C:\\Program Files\\Java\\jdk-17.0.1\\bin\\java.exe\" -Djpda.listen=true -Djpda.address=52253 \"-Dmaven.ext.class.path=C:\\Program Files\\NetBeans\\NetBeans-20\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec"
Scanning for projects...

-------------------------< com.slipbits:slip >--------------------------
Building slip 1.0-SNAPSHOT
  from pom.xml
--------------------------------[ jar ]---------------------------------

--- resources:3.3.1:resources (default-resources) @ slip ---
skip non existing resourceDirectory D:\home\skidmarks\Projects\Unique\Project\slip\src\main\resources

--- compiler:3.11.0:compile (default-compile) @ slip ---
Nothing to compile - all classes are up to date

--- exec:3.1.0:exec (default-cli) @ slip ---
Error: Could not find or load main class com.mycompany.slip.Slip
Caused by: java.lang.ClassNotFoundException: com.mycompany.slip.Slip
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)     at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)     at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)     at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:1000)     at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:947)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:471)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)     at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)     at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)     at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)     at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)     at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  1.117 s
Finished at: 2024-04-02T11:07:06-07:00
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (default-cli) on project slip: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

On 4/2/2024 11:02 AM, Tamás Cservenák wrote:
Howdy,

src/main/java and src/test/java is the maven standard...

T

On Tue, Apr 2, 2024, 19:46 slipbits <slipb...@slipbits.com> wrote:

    I know this is a dumb question but I'm stumped. I created a new
    project and NB created src/main and src/test subdirectories. When
    I created my test code in src/test/... NB recognized the main
    package and I could link to it i n the editor and run compiles.
    But when I try to execute in in the debugger (debug->run) it
    fails to load because it can't find the main package.

    The project is a maven project, and I am beginning to read the
    maven material to see if that will help. But, can you shortcut
    the process and please tell me how to correct the issue and give
    me a hint as to where I can look for additional resources.

    thatnks



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to