PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
Exemplo WINDEV rodando java criando o ponto CLASS e retornando o resultado em txt ou na interface wx do seu projeto
Published by Boller
in the category Tools
New features



Description
Exemplo WINDEV rodando java criando o ponto CLASS e retornando o resultado em txt ou na interface wx do seu projeto

PRE REQUISITO NO MS-DOS

JAVA OK
JAVAC OK
JAVAW OK

by PAULO VIANA

// Summary: <specify the procedure action>
// Syntax:
// EXE_JAVA ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE EXE_JAVA()

codigojava is string=[
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class exemplo01 {

// Método que retorna uma string
public String getGreeting() {
return "Hello, World!";
}

public static void main(String[] args) {
// Cria uma instância da classe
exemplo01 example = new exemplo01();

// Chama o método e armazena o valor retornado
String greeting = example.getGreeting();

// Caminho do arquivo onde o resultado será salvo
String filePath = "C:\\temp\\java\\hello.txt";

// Tenta salvar o valor retornado em um arquivo
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
writer.write("The method returned: " + greeting);
} catch (IOException e) {
// Trata a exceção silenciosamente sem imprimir no console
}
}
}
]

manifesto is string=[
Manifest-Version: 1.0
Main-Class: Application
]

fSaveText("c:\temp\java\manifest.mf",StringToUTF8(manifesto))

comando1 is string=[
javac exemplo01.java
]

comando2 is string=[
java exemplo01
]

fMakeDir("c:\temp\")

fMakeDir("c:\temp\java\")

fSaveText("c:\temp\java\exemplo01.java",StringToUTF8(codigojava))

sReturn is string

// Starts the application
sReturn = ExeRun(comando1, exeActive, exeReturnValue,"c:\temp\java")

IF ErrorOccurred THEN
Error()
END

// Starts the application
sReturn = ExeRun(comando2, exeActive, exeReturnValue,"c:\temp\java")

IF ErrorOccurred THEN
Error()
END

ShellExecute("C:\temp\java\hello.txt")

EDT_result = fLoadText("C:\temp\java\hello.txt")
Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
No review or comment? Be the first one!