Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with taking input #655

Open
Arc29 opened this issue Jan 10, 2022 · 1 comment
Open

Problem with taking input #655

Arc29 opened this issue Jan 10, 2022 · 1 comment
Assignees

Comments

@Arc29
Copy link

Arc29 commented Jan 10, 2022

I am trying to compile some code which takes input using BufferedReader:
`package main;

import java.util.StringTokenizer;
import java.io.*;

class HelloWorld{
static class FastReader {
BufferedReader br;
StringTokenizer st;

    public FastReader()
    {
        br = new BufferedReader(
            new InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() { return Integer.parseInt(next()); }

    long nextLong() { return Long.parseLong(next()); }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try {
            str = br.readLine();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}
public static void main(String[] args){
	FastReader s = new FastReader();
    int n = s.nextInt();
    int k = s.nextInt();
    int count = 0;
    while (n-- > 0) {
        int x = s.nextInt();
        if (x % k == 0)
            count++;
    }
    System.out.println(count);
}

}`

It gets compiled fine. But when I run it on browser, I am getting this error:

Uncaught TypeError: bytecoder.filehandles[handle].readBytesINTL1BYTEINTINT is not a function at Object.readBytesINTL1BYTEINTINT (bytecoder.js:577) at C.INTreadBytesINTA1BYTEINTINT (bytecoder.js:64516) at C.p.INTreadA1BYTEINTINT (bytecoder.js:64537) at C.p.INTreadBytes (bytecoder.js:70032) at C.p.INTimplReadA1CHARINTINT (bytecoder.js:69837) at C.p.INTreadA1CHARINTINT (bytecoder.js:69478) at C.p.INTreadA1CHARINTINT (bytecoder.js:65219) at C.p.VOIDfill (bytecoder.js:63357) at C.p.jlStringreadLineBOOLEANA1BOOLEAN (bytecoder.js:63093) at C.p.jlStringreadLine (bytecoder.js:63006)

Please help.

@mirkosertic mirkosertic self-assigned this Jan 25, 2022
@MahitMehta
Copy link

Hi, I have a similar issue, when attempting to use Scanner in java code, the build fails as shown below.

[ERROR] Failed to execute goal de.mirkosertic.bytecoder:bytecoder-mavenplugin:2021-11-02:compile (default) on project 
jbytecode: Error running bytecoder: Error linking class sun.util.locale.provider.LocaleProviderAdapter: Cannot find static 
method getLogger in java/lang/System with signature java.lang.System$Logger(java.lang.String) -> [Help 1]

If there is a way to use Scanner util in Java, your help would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants