Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Erstmal sorry, falls dieses Thema hier Fehl am Platze ist oder Ähnliches.

Vlt. kann mir ja jemand bei meinem JAVA Programm Problem helfen:

Ich möchte mit meinem JAVA Programm auf eine Excel-Tabelle zugreifen.

Dazu habe ich zuerst die erforderlichen Packages importiert

import java.io.File;

import java.util.Date;

import jxl.*;

Funktioniert. :)

Dann habe ich folgenden Code erstellt:

Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));

Sheet sheet = workbook.getSheet(0);

Cell a1 = sheet.getCell(0,0);

Cell b2 = sheet.getCell(1,1);

Cell c2 = sheet.getCell(2,1);

String stringa1 = a1.getContents();

String stringb2 = b2.getContents();

String stringc2 = c2.getContents();

Hier hängt es allerdings und ich bekomme eine Fehlermeldung. Diese konnte ich nur beheben, indem ich das gesamte Konstrukt in ein "throws Exception" geschrieben habe.

public void tabletest() throws Exception {

Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));

Sheet sheet = workbook.getSheet(0);

Cell a1 = sheet.getCell(0,0);

Cell b2 = sheet.getCell(1,1);

Cell c2 = sheet.getCell(2,1);

String stringa1 = a1.getContents();

String stringb2 = b2.getContents();

String stringc2 = c2.getContents();

}

Das lässt sich dann auch problemlos compilieren, aber ich kann nicht auf die Werte zugreifen, die aus der Tabelle gelesen werden. Ich habe testweise einen Knopf erstellt und will mir auf Knopfdurck einen Wert aus einer Tabelle in einem Textfeld ausgeben lassen. Vlt. weiß ja hier jemand Rat, wie ich die Werte Variablen zuweisen kann. Würde mich sehr freuen. :)

Eigentlich bin ich recht fit in JAVA, aber daran hängts gerade etwas. Ich hoffe die Lösung ist nicht all zu simpel, sonst blamiere ich mich noch. :D

Mfg Mike

Ist es denn so schwer die Fehlermeldung zu nennen?

Naja, da ich eigentlich das Problem ja nicht mehr habe, dachte ich, dass wäre nicht mehr relevant. Ich möchte ja gerne auf die Werte zugreifen können. Aber ich kann gerne noch mal die Fehlermeldung posten, wenn es weiterhilft:

unreported exception java.io.IOException; must be caught or declared to be thrown

Mfg Mike

Bitte überlege Dir einmal was eine Exception ist und wofür sie da ist.

Das lässt sich dann auch problemlos compilieren, aber ich kann nicht auf die Werte zugreifen, die aus der Tabelle gelesen werden.

Du solltest Dir vielleicht einmal überlegen, warum das dann der Fall ist, dass es sich auf wundersame Weise, nachdem Du die Methode mit "throws Exception" erweitert hast, compilieren lässt.

Ohne dass Du hier eine konkrete Fehlermeldung nennt, kann man Dir nicht helfen.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.