Results 1 to 8 of 8
Thread: Java iPad compiler issue
- 04-11-2012, 08:33 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 4
- Rep Power
- 0
Java iPad compiler issue
Hello all, It's my first time in these forums and I have no idea as to where i should post this, so I figured might as well here.
Anyways let's get down to business.
I've downloaded a compiler app for java for my ipad Java Programming Language - iOS app from Yauheni Shauchenka | Appolicious ™ iPhone and iPad App Directory and I've been getting some issues that don't happen in a compiler for a PC. For example apparently I can't have a program that asks the user to input information such as names, numbers, etc. here is the code of the program I'm currently trying out :
And the erros I took screenshots of are:Java Code:import java.io.*; import java.util.*; public class Main{ public static BufferedReader var=new BufferedReader(new InputStreamReader(System.in)); public static void main(String []arg)throws Exception{ String cadena1; String cadena2; String sub1; String sub2; String sub3; String sub4; String sub5; String sub6; System.out.println("Escribe tu nombre (Primer Nombre, Apellido Paterno y Apellido Materno) "); //. first and last names cadena1=var.readLine(); System.out.println("Escribe el dia que naciste en el formato dd/mm/aaaa "); // date of birth DD/MM/YYYY cadena2=var.readLine(); StringTokenizer token1; token1=new StringTokenizer(cadena1," "); String cad1=token1.nextToken(); String cad2=token1.nextToken(); String cad3=token1.nextToken(); StringTokenizer token2; token2=new StringTokenizer(cadena2,"/"); String cad4=token2.nextToken(); String cad5=token2.nextToken(); String cad6=token2.nextToken(); sub1=cad1.substring(0,1); sub2=cad2.substring(0,2); sub3=cad3.substring(0,1); sub4=cad4.substring(0,2); sub5=cad5.substring(0,2); sub6=cad6.substring(2,4); System.out.println("Tu RFC es " + sub2 + sub3 + sub1 + sub6 + sub5 + sub4); // RFC = latin american document } }


I took the liberty of translating parts of the code that were in spanish to english in comments.
I should point out that this program works 100% in my netbeans compiler on my PC. I've also compiled and ran various simple programs in this app for the ipad, and no issues there. However I've encountered issues on programs that require the user's input.
Here are the screenshots of how my code looks in the actual app:


Anyways, any ideas or clues as how to fix the specific issue of this code? Or better yet, can this app actually compile and run programs which require user input?
Thank you for reading.Last edited by MightyKing; 04-11-2012 at 06:35 PM. Reason: Asterisks removed to avoid confusion
- 04-11-2012, 09:11 AM #2
- 04-11-2012, 05:11 PM #3
Member
- Join Date
- Apr 2012
- Posts
- 4
- Rep Power
- 0
Re: Java iPad compiler issue
Sorry I thought that was a no brainer, the asterisks were placed there after adding the [ CODE][/CODE] parameters in the post. No real asterisks are there in the actual code.. That's exactly the reason I posted the screenshots of the actual code in the app in the first place. Allow me to do so again.
This is how the real code looks in the compiler:


Thank you.
- 04-11-2012, 06:25 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Java iPad compiler issue
Can you copy and paste the errors instead of putting up screenshots...they're a pain.
Please do not ask for code as refusal often offends.
- 04-11-2012, 06:35 PM #5
Member
- Join Date
- Apr 2012
- Posts
- 4
- Rep Power
- 0
- 04-12-2012, 10:03 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Java iPad compiler issue
And which line is line 22 (again paste it in)?
What is null on that line?Please do not ask for code as refusal often offends.
- 04-12-2012, 05:24 PM #7
Member
- Join Date
- Apr 2012
- Posts
- 4
- Rep Power
- 0
Re: Java iPad compiler issue
I had already done that if you read the first post. Anyways here it is again...
Java Code:import java.io.*; import java.util.*; public class Main{ public static BufferedReader var=new BufferedReader(new InputStreamReader(System.in)); public static void main(String []arg)throws Exception{ String cadena1; String cadena2; String sub1; String sub2; String sub3; String sub4; String sub5; String sub6; System.out.println("Escribe tu nombre (Primer Nombre, Apellido Paterno y Apellido Materno) "); //. first and last names cadena1=var.readLine(); System.out.println("Escribe el dia que naciste en el formato dd/mm/aaaa "); // date of birth DD/MM/YYYY cadena2=var.readLine(); StringTokenizer token1; token1=new StringTokenizer(cadena1," "); String cad1=token1.nextToken(); String cad2=token1.nextToken(); String cad3=token1.nextToken(); StringTokenizer token2; token2=new StringTokenizer(cadena2,"/"); String cad4=token2.nextToken(); String cad5=token2.nextToken(); String cad6=token2.nextToken(); sub1=cad1.substring(0,1); sub2=cad2.substring(0,2); sub3=cad3.substring(0,1); sub4=cad4.substring(0,2); sub5=cad5.substring(0,2); sub6=cad6.substring(2,4); System.out.println("Tu RFC es " + sub2 + sub3 + sub1 + sub6 + sub5 + sub4); // RFC = latin american document } }
- 04-13-2012, 10:03 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Java iPad compiler issue
Except many people don't print their entire code here so the line numbers rarely match.
Consequently I try not to waste my time looking at lines that may well turn out not to be the ones causing the problem.
Add a println prior to the creation of the tokeniser to print out what cadena1 is.
It seems to think it's null at this point.
readLine() will only return null if end of stream is encountered, which it shouldn't do in this case (though who knows with an iPad). It could well be a bug in the JVM/SDK you're forced to use.Please do not ask for code as refusal often offends.
Similar Threads
-
Medical iPad and iPhone Icons
By java software in forum Java SoftwareReplies: 0Last Post: 12-17-2011, 03:23 PM -
Interfacing with an ipad
By cullam in forum Advanced JavaReplies: 2Last Post: 09-08-2011, 01:11 AM -
Compiler Output Window Issue
By sweetpea123 in forum New To JavaReplies: 2Last Post: 04-10-2010, 05:56 PM -
How to Set up my Java Compiler
By Galore in forum New To JavaReplies: 4Last Post: 01-17-2010, 05:57 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks