Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!

Nikolas Nikolaou

Ranch Hand
+ Follow
since Jan 30, 2014
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
35
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nikolas Nikolaou

To sum it up, I basically need help parsing the data when the fields will be unknown.

I can't create predefined strings / arrays.
Hi. Thanks for the reply.

I only learned about JSON a few days ago and am trying to grasp the syntax / parsing process.

As mentioned earlier, I need to retrieve the routes for a specific boxID. A list of boxID's will be retrieved from a serve In the format below.

So far, the Info I am finding Involves creating classes with predefined strings/arrays etc and loading these values from JSON to the JAVA class.

I cannot do this as I will be downloading Info on the fly.

What would be the best procedure to Just retrieve the required values as Strings/Arrays ?

Hi.

I'm trying to pass the following code from JSON to JAVA:




I would like for each boxid .. to be parsed Into the relevant credentials/routes.

Should I be converting this specific JSON format to a two dimensional Array for each boxid ?
Hi.
Thanks for the reply.
I know how to access the JAR but my main question Is, am I downloading the correct JAR files ( as some forums suggest only the one obtained via github/maven Is the correct one and I
would need to use maven to obtain that file.

I have downloaded the file(s) from the following link: www.java2s.com › Jar File Download › gson
1 year ago
Hi.

I need to use the external GSON library and was wondering how I can download this.

I'm a bit confused. I see some direct links to JAR files and then some other forums saying I must install MAVEN and extract the ZIP from there.

I'm using only notepad++ for development at present, no IDE.

Thanks In advance.
1 year ago
Thanks for both answers. Will check the rasdial without cmd and definitely read that artical again (a lot more thoroughly this time).
1 year ago
Hi. I'm trying to read the output of a Runtime.getRuntime().exec cmd process ( a rasdial connection ).

I'm using the below code and the connection establishes fine but I can't see any output redirecting to java. I can see the output from the cmd box.

Any assistance would be appreciated.

Thanks.

1 year ago
Hi.
In reply to Stephan van Hulst ,

If I use only cmd /K there Is no output appearing. It works but I need to show the output from the cmd.
2 years ago
Hi. I'm using the below runtime command :




This works fine. I can pipe the powershell file from cmd.

When I run this however :



It Just runs the type command and prints the output In the window. It's not getting piped to powershell.

I need to use the second method because I want the user to see the output.

Not sure what's going wrong here and would appreciate any Info.

Thanks.
2 years ago
Do you mean Powershell needs access to the script ?

The code Is being typed In CMD and piped Into powershell so It doesn't need direct access If that's what you mean.

Sorry , I may have not understood correctly.
2 years ago
Hi.
I can run the command If I place the script file In the same folder as the JAR file.

I would like to place the script file within the JAR and run the same command.
2 years ago
Hi. I have a JAR app that requires piping a powershell file from the command line using the Runtime.getRuntime().exec

I know how to access a resource from within a JAR but In this case , I'm not sure how I can run the below command.

Do I need to get the resource as a file and somehow use the filename In the cmd String ?


2 years ago
Oh ok. I didn't know that. Thanks for the Info.
2 years ago