Re: NetBeans integrated terminal

2024-04-02 Thread Antonio

Hi Pavel,

Some answers below.

On 2/4/24 22:36, PavelTurk wrote:

Hello all.

Could anyone explain how it is possible to run native application, for 
example, midnight commander in NB terminal?


NetBeans uses a pure-Java terminal emulator. This is spread in different 
modules, the low-level module with support for terminal emulation is the 
"ide/lib.terminalemulator" module. Here's a pointer to get you started:


https://github.com/apache/netbeans/blob/905ff7ef8344e372318751f6e93082a35da3b87f/ide/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/Term.java


I mean NB is a java application and as I understand it uses swing 
library for UI. And how  was native application made

to work inside java application with swing? What is the magic here?


As explained by Thomas Wolf, you can launch any operating system process 
(say midnight commander) using the Java's ProcessBuilder class (NetBeans 
also has ad-hoc process launching mechanisms that were in place before 
ProcessBuilder was invented, see [1]).


Once you launch an external process the modules 
"ide/lib.terminalemulator", "ide.terminalnb", "ide/dlight.terminal" and 
some others are responsible for painting the terminal emulator in Swing.


Hope this helps,
Antonio


[1]
https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-extexecution-base/overview-summary.html




Best regards, Pavel

-
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



-
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



Re: NetBeans integrated terminal

2024-04-02 Thread Thomas Wolf
I don't know how the Netbeans team chose to implement its terminal feature.  
But I'd imagine it would involve a Java Swing component such as JEditorPanel 
and sending Midnight commander's stdout/stderr streams to that panel and 
forwarding keyboard input to the stdin of that application.

tom

> On Apr 2, 2024, at 4:47 PM, PavelTurk  wrote:
> 
> midnight commander TUI interface



Re: NetBeans integrated terminal

2024-04-02 Thread PavelTurk

Thank you for your answer. It is clear, that it is possible to run external 
processes.

The question is about "view". How midnight commander TUI interface is rendered 
in Swing Window?

Best regards, Pavel

On 4/2/24 11:43 PM, Thomas Wolf wrote:

Just because an application was written in Java doesn't mean it can't run 
external processes.  Look into the java API documentation on ProcessBuilder 
class.
Tom



On Apr 2, 2024, at 4:36 PM, PavelTurk  wrote:

Hello all.

Could anyone explain how it is possible to run native application, for example, 
midnight commander in NB terminal?
I mean NB is a java application and as I understand it uses swing library for 
UI. And how  was native application made
to work inside java application with swing? What is the magic here?

Best regards, Pavel

-
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




-
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



Re: NetBeans integrated terminal

2024-04-02 Thread Thomas Wolf
Just because an application was written in Java doesn't mean it can't run 
external processes.  Look into the java API documentation on ProcessBuilder 
class.
Tom


> On Apr 2, 2024, at 4:36 PM, PavelTurk  wrote:
> 
> Hello all.
> 
> Could anyone explain how it is possible to run native application, for 
> example, midnight commander in NB terminal?
> I mean NB is a java application and as I understand it uses swing library for 
> UI. And how  was native application made
> to work inside java application with swing? What is the magic here?
> 
> Best regards, Pavel
> 
> -
> 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
> 


-
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



NetBeans integrated terminal

2024-04-02 Thread PavelTurk

Hello all.

Could anyone explain how it is possible to run native application, for example, 
midnight commander in NB terminal?
I mean NB is a java application and as I understand it uses swing library for 
UI. And how  was native application made
to work inside java application with swing? What is the magic here?

Best regards, Pavel

-
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



Re: Can;t link src/test/java to package being tested.

2024-04-02 Thread Michael Bien
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 
com.mycompany.slip.Slip to 
Slip 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 
 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 

Re: Can;t link src/test/java to package being tested.

2024-04-02 Thread slipbits

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 
com.mycompany.slip.Slip to 
Slip 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  
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 

Re: Can;t link src/test/java to package being tested.

2024-04-02 Thread Tamás Cservenák
Howdy,

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

T

On Tue, Apr 2, 2024, 19:46 slipbits  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
>


Can;t link src/test/java to package being tested.

2024-04-02 Thread slipbits
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


Re: Error refactoring code

2024-04-02 Thread PavelTurk

Hi!

See https://github.com/apache/netbeans/issues/3725

Best regards, Pavel

On 4/2/24 6:42 PM, Tellis, Wyatt wrote:

Hi,

I'm trying to rename a method on a class and keep getting the following error:

Module Java Refactoring threw java.lang.IllegalStateException: java.lang.NullPointerException: 
Cannot invoke "com.sun.tools.javac.code.Type.getThrownTypes()" because 
"tree.meth.type" is null.


I've done this many times before and this is the first time I've run into an 
issue.   Restarting NB didn't fix it.   What could be causing this? I'm using 
NB21 with Java 17.0.10+7 running on Windows 10.

Thanks,

Wyatt

-
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




-
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



Error refactoring code

2024-04-02 Thread Tellis, Wyatt
Hi,

I'm trying to rename a method on a class and keep getting the following error:

Module Java Refactoring threw java.lang.IllegalStateException: 
java.lang.NullPointerException: Cannot invoke 
"com.sun.tools.javac.code.Type.getThrownTypes()" because "tree.meth.type" is 
null. 


I've done this many times before and this is the first time I've run into an 
issue.   Restarting NB didn't fix it.   What could be causing this? I'm using 
NB21 with Java 17.0.10+7 running on Windows 10.

Thanks,

Wyatt

-
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