-1

I am getting the following error in VScode IDE . Kindly help me with the Solutions related to VScode

I created a package named as test in visual studio code . The program written in that package failed to execute , program is :

package test;
public class Example{
public static void main(String args[])
{
    System.out.println("HELLO");
}
}

It throws an error the same program works completely fine when placed in the default package here it is kindly help me with the package working or help me if there is any setting in vscode which has to be setup

1 Answers1

1

The problem is that you cannot run the code from inside the package.

You will have to run the code from Parent Dir of package

EG. If your files,package is structured this way

SomeDirectory
|----test
│    |----Example.class

then you have run it from SomeDirectory by java test.Example

oddity
  • 77
  • 7
  • can you help me specifically with the working of java program inside packages in visual studio code. because above code is working completely fine with the command prompt. I am getting that error in visual studio code IDE which needs to be fixed . – Akash Gusain May 24 '20 at 05:29