opening isdn connection with external file

N

nescafe

Hello.
Im using netbeans on my linux box but the program will be placed on
windowz box.That's why i use .bat file. I can put this into code but
it's simple to work with .bat file.

Anyway, here is the problem...
I have to open ISDN connection and make the dial.
The connection is in part of local area connection and i can start it
with netsh or devcon. This part is tested and working.
But... to complete the process i have to click on "Dial" button.

Simply put... i start the connection with my java program and connection
awaits dial confirmation click.

How to make this "click" in my java program ?
 
J

Jeff Higgins

Hello.
Im using netbeans on my linux box but the program will be placed on
windowz box.That's why i use .bat file. I can put this into code but
it's simple to work with .bat file.

Anyway, here is the problem...
I have to open ISDN connection and make the dial.
The connection is in part of local area connection and i can start it
with netsh or devcon. This part is tested and working.
But... to complete the process i have to click on "Dial" button.

Simply put... i start the connection with my java program and connection
awaits dial confirmation click.

How to make this "click" in my java program ?
import javax.swing.JOptionPane;

public class OptionTest {

public static void main(String[] args) {

int chosenOption = JOptionPane.showConfirmDialog(
null,
"Confirm dial?",
"ISDN Connection",
JOptionPane.YES_NO_CANCEL_OPTION );

String optionMessage;
if (chosenOption == JOptionPane.CANCEL_OPTION) {
optionMessage = "Cancel option chosen";
}
else if (chosenOption == JOptionPane.NO_OPTION) {
optionMessage = "No option chosen";
}
else if (chosenOption == JOptionPane.YES_OPTION){
optionMessage = "Yes option chosen";
}
else {optionMessage = "Unexpected Option";}

JOptionPane.showMessageDialog(null, optionMessage);
}
}
 
N

nescafe

Hello.
Im using netbeans on my linux box but the program will be placed on
windowz box.That's why i use .bat file. I can put this into code but
it's simple to work with .bat file.

Anyway, here is the problem...
I have to open ISDN connection and make the dial.
The connection is in part of local area connection and i can start it
with netsh or devcon. This part is tested and working.
But... to complete the process i have to click on "Dial" button.

Simply put... i start the connection with my java program and connection
awaits dial confirmation click.

How to make this "click" in my java program ?
import javax.swing.JOptionPane;

public class OptionTest {

public static void main(String[] args) {

int chosenOption = JOptionPane.showConfirmDialog(
null,
"Confirm dial?",
"ISDN Connection",
JOptionPane.YES_NO_CANCEL_OPTION );

String optionMessage;
if (chosenOption == JOptionPane.CANCEL_OPTION) {
optionMessage = "Cancel option chosen";
}
else if (chosenOption == JOptionPane.NO_OPTION) {
optionMessage = "No option chosen";
}
else if (chosenOption == JOptionPane.YES_OPTION){
optionMessage = "Yes option chosen";
}
else {optionMessage = "Unexpected Option";}

JOptionPane.showMessageDialog(null, optionMessage);
}
}
ok i will try ,but just to elaborate...
The "isdn window" is external program.
Start / network connections / isdn connection.
 
N

nescafe

/*
* KutinaApp.java
*/

package kutina;
import javax.swing.JOptionPane;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class KutinaApp extends SingleFrameApplication {

@Override protected void startup() {
show(new KutinaView(this));
}
@Override protected void configureWindow(java.awt.Window root) {
}
public static KutinaApp getApplication() {
return Application.getInstance(KutinaApp.class);
}

//--------------------------------------------------------------------------
public class JOptionPaneTest1 {

public static void main(String[] args) {
//******** inner class cannot have static declarations ************

launch(KutinaApp.class, args );

//-----------------------
int chosenOption = JOptionPane.showConfirmDialog(
null,
"Call?",
"ISDN",
JOptionPane.YES_NO_CANCEL_OPTION );

String optionMessage;
if (chosenOption == JOptionPane.CANCEL_OPTION) {
optionMessage = "Cancel";
}
else if (chosenOption == JOptionPane.YES_OPTION){
optionMessage = "Confirm";
}
else {optionMessage = "Error";}

JOptionPane.showMessageDialog(null, optionMessage);
}
}
}
 
J

Jeff Higgins

/*
* KutinaApp.java
*/

package kutina;
import javax.swing.JOptionPane;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class KutinaApp extends SingleFrameApplication {

@Override protected void startup() {
show(new KutinaView(this));
}
@Override protected void configureWindow(java.awt.Window root) {
}
public static KutinaApp getApplication() {
return Application.getInstance(KutinaApp.class);
}

//--------------------------------------------------------------------------

public class JOptionPaneTest1 {

public static void main(String[] args) {
//******** inner class cannot have static declarations ************

launch(KutinaApp.class, args );

Try this:
Application.launch(KutinaApp.class, args );
//-----------------------

You probably want to put your Confirm Dial-out in an action.
 
L

Lew

/*
* KutinaApp.java
*/

package kutina;
import javax.swing.JOptionPane;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class KutinaApp extends SingleFrameApplication {

@Override protected void startup() {
show(new KutinaView(this));
}
@Override protected void configureWindow(java.awt.Window root) {
}
public static KutinaApp getApplication() {
return Application.getInstance(KutinaApp.class);
}

//--------------------------------------------------------------------------
public class JOptionPaneTest1 {

public static void main(String[] args) {
//******** inner class cannot have static declarations ************

Since you declared 'JOptionPaneTest1' (terrible name) inside another type
without the 'static' keyword, it's an inner class, not a static nested class.
Inner classes cannot have static members. You declared a static member
'main()' within that inner class. Just like the message says, inner classes
cannot have static declarations.

Very straightforward.

As Jeff suggested, the tutorial is a great place to start. After that, GIYF, too.
 
J

Jeff Higgins

/*
* KutinaApp.java
*/

package kutina;
import javax.swing.JOptionPane;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class KutinaApp extends SingleFrameApplication {

@Override protected void startup() {
show(new KutinaView(this));
}
@Override protected void configureWindow(java.awt.Window root) {
}
public static KutinaApp getApplication() {
return Application.getInstance(KutinaApp.class);
}

//--------------------------------------------------------------------------

public class JOptionPaneTest1 {

public static void main(String[] args) {
//******** inner class cannot have static declarations ************

Since you declared 'JOptionPaneTest1' (terrible name) inside another
type without the 'static' keyword, it's an inner class, not a static
nested class. Inner classes cannot have static members. You declared a
static member 'main()' within that inner class. Just like the message
says, inner classes cannot have static declarations.

Very straightforward.

As Jeff suggested, the tutorial is a great place to start. After that,
GIYF, too.
Huh, it's so funny how my feeble little mind works (or doesn't) sometimes.
Despite the OP's code sample , error message, and pointer to the line
where the error occurred; I completely missed the public class
JOptionPaneTest1 declaration!
Thanks.
 
N

nescafe

Jeff said:
Lew said:
nescafe wrote:
/*
* KutinaApp.java
*/

package kutina;
import javax.swing.JOptionPane;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class KutinaApp extends SingleFrameApplication {

@Override protected void startup() {
show(new KutinaView(this));
}
@Override protected void configureWindow(java.awt.Window root) {
}
public static KutinaApp getApplication() {
return Application.getInstance(KutinaApp.class);
}

//--------------------------------------------------------------------------


public class JOptionPaneTest1 {

public static void main(String[] args) {
//******** inner class cannot have static declarations ************

Since you declared 'JOptionPaneTest1' (terrible name) inside another
type without the 'static' keyword, it's an inner class, not a static
nested class. Inner classes cannot have static members. You declared a
static member 'main()' within that inner class. Just like the message
says, inner classes cannot have static declarations.

Very straightforward.

...
-------------------------
I get error : inner classes cannot have static declarations ?
I googleit but all examples are the same and there should be no error.

As Jeff suggested, the tutorial is a great place to start. After that,
GIYF, too.
Huh, it's so funny how my feeble little mind works (or doesn't)
sometimes.
Despite the OP's code sample , error message, and pointer to the line
where
the error occurred; I completely missed the public class JOptionPaneTest1
declaration!

That's because his indentation sucks. He did everything in his power to
hide that the inner class was an inner class.

I had to reconstruct the indentation for my reply to be readable. This
made it obvious that the ill-named 'JOptionPaneTest1' was an inner class.
--------------------
OK.
I do have one more question.
If i open isdn connection and directly after that i open some data
logger i can not close the same isdn connection ** automatically** on
data logger closing. Basicaly, i close data logger program but isdn
connections is still connected.

Shortly:
open isdn connection
open datalogger
close datalogger
close isdn connection.

When program starts, he opens isdn and when i X-it the datalogger, isdn
should be closed and not before.
 
L

Lew

nescafe said:
OK.
I do have one more question.
If i open isdn connection and directly after that i open some data logger i
can not close the same isdn connection ** automatically** on data logger
closing. Basicaly, i close data logger program but isdn connections is still
connected.

Shortly:
open isdn connection
open datalogger
close datalogger
close isdn connection.

When program starts, he opens isdn and when i X-it the datalogger, isdn should
be closed and not before.

Wrap the datalogger part in a 'try{}' and close the ISDN in the 'finally{}'.
 
N

nescafe

Wrap the datalogger part in a 'try{}' and close the ISDN in the
'finally{}'.
-----------
i can not do this beacuse im using bat file to do this:
cd..
cd prog
cd cms
cms.exe

I didnt implement this into code.
 
L

Lew

I can't speak for everyone here, but no.

You are going about the whole thing bassackwards.

I can give Java insight here in this Java newsgroup.

I do have two observations:

- Coordinating logic within a program from outside that program without the
program having hooks for such control is likely not feasible at all.

- Running a Java program as a system-specific artifact, and black box at that,
is not the highest, best use of Java.

My advice is to "implement this into code", as you put it.

If you need Windows advice, as you indicate that you do, this is the wrong
newsgroup. comp.lang.java.programmer is a discussion group (not helpdesk) for
Java programming topics. You appear unwilling to discuss Java.
 
N

nescafe

I can't speak for everyone here, but no.

You are going about the whole thing bassackwards.

I can give Java insight here in this Java newsgroup.

I do have two observations:

- Coordinating logic within a program from outside that program without
the program having hooks for such control is likely not feasible at all.

- Running a Java program as a system-specific artifact, and black box at
that, is not the highest, best use of Java.

My advice is to "implement this into code", as you put it.

If you need Windows advice, as you indicate that you do, this is the
wrong newsgroup. comp.lang.java.programmer is a discussion group (not
helpdesk) for Java programming topics. You appear unwilling to discuss
Java.
 
L

Lew

nescafe said:
i [sic] agree with you totaly.
The reason why i put this into bat file was because i couldn't not define the
string with all of the commands in it (i get always syntax or compile error )

If you're talking about Java code, or a command-line difficulty getting your
program to run, perhaps we can help.

You could share the contents the .bat file. It doesn't have to reveal any
proprietary information but should give a good example of what you're dealing
with. Then maybe we can help with that.

It's just that with the little fragments of code, and none of .bat, that
you've shown, and rather vague descriptions of your difficulties, it's very
hard to give you good assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top